package com.xx.pmis.services.implementations;

import java.util.List;

import com.xx.pmis.model.Card;
import com.xx.pmis.persistence.dao.CardDAO;
import com.xx.pmis.services.CardService;

public class CardServiceImpl implements CardService {
	CardDAO cardDAO = null;

	public CardServiceImpl(CardDAO cardDAO) {
		super();
		this.cardDAO = cardDAO;
	}

	public void saveOrUpdateCard(Card card) throws Exception {
		cardDAO.saveOrUpdate(card);
	}

	public void saveCard(Card card) throws Exception {
		cardDAO.save(card);
	}

	public void deleteCard(Card card) throws Exception {
		cardDAO.delete(card);
	}

	public Card getCardByCardID(String cardID) throws Exception {
		Card card = cardDAO.getCardByCardID(cardID);
		return card;
	}

	public List<Card> getAllCard() throws Exception {
		List<Card> cards = cardDAO.getAllCard();
		return cards;
	}

	public List<Card> getAllCardByPage(int currentPage, int lineSize) throws Exception {
		List<Card> cards = cardDAO.getAllCardByPage(currentPage, lineSize);
		return cards;
	}

	public int getCountOfCard() throws Exception {
		return cardDAO.getAllCard().size();
	}


}
